<template>
  <div class="m-prodects-index">
    <!-- 头部动图 -->
    <div class="video-banner-wrap">
      <div class="video-banner">
        <div class="video-banner-inner">
          <video
            autoplay=""
            muted="muted"
            preload="auto"
            x5-video-player-type="h5"
            x5-video-orientation="portraint"
            controls360="no"
            raw-controls="true"
            x5-video-player-fullscreen="false"
            x-webkit-airplay="true"
            airplay="allow"
            webkit-playsinline="true"
            playsinline="true"
            loop="loop"
            src="https://yunlian-oss-product.oss-cn-hangzhou.aliyuncs.com/website/product.mp4"
            poster="https://yunlian-oss-product.oss-cn-hangzhou.aliyuncs.com/website/p.jpg"
          ></video>
        </div>
      </div>
    </div>
    <!-- 产品分类 -->
    <section class="m-container">
      <div class="list-item" v-for="item in allCategoryList" :key="item.bigTypeName">
        <div class="item-divider">
          <div class="title-divider">
            <div class="divider-text">
              <span class="title-text">{{ item.bigTypeNameOfLang }}</span>
            </div>
          </div>
        </div>
        <div class="list-assort">
          <a
            class="assort-item"
            :href="`/m-products-list/${item.bigTypeName}-${subItem.subTypeName}`"
            :title="item.bigTypeNameOfLang"
            v-for="subItem in item.subCategoryVOList"
            :key="subItem.subTypeName"
          >
            <img :src="subItem.coverImage" :alt="subItem.subTypeNameOfLang" />
            <p>{{ subItem.subTypeNameOfLang }}</p>
          </a>
        </div>
      </div>
    </section>
    <!-- WhatsApp -->
    <!-- <WhatsAppM v-if="locale == 'en-US'" /> -->
    <!-- 底部信息 -->
    <FooterM></FooterM>
  </div>
</template>

<script>
import { mapState } from "vuex"
export default {
  name: "M-prodectsIndex",
  layout: "mobile",
  components: {},
  data() {
    return {}
  },
  head() {
    return {
      title: this.$i18n.t("headTitle"),
      meta: [
        {
          hid: "keywords",
          name: "keywords",
          content: this.$i18n.t("haeaKeyContent")
        },
        {
          hid: "description",
          name: "description",
          content: this.$i18n.t("haeaDecContent")
        }
      ]
    }
  },
  async asyncData({ app, query }) {
    let allCategoryList = []
    try {
      let { data } = await app.$api.allCategory()
      allCategoryList = data || []
    } catch (error) {
      console.log(error)
    }
    return {
      allCategoryList
    }
  },
  props: {},
  computed: { ...mapState(["locale"]) },
  async mounted() {
    this.getPoint()
  },
  methods: {
    async getPoint() {
      let params = await this.$optionPoint.sendUrl(window, navigator, document)
      this.$api.burySave({ ...params }).then((res) => {})
    }
  },
  watch: {}
}
</script>

<style lang="scss" scoped>
.m-prodects-index {
  .video-banner-wrap {
    width: 100%;
    margin: 0 auto;
    overflow: hidden;
    margin-top: 225px;
    .video-banner {
      width: 100%;
      padding-bottom: 50%;
      position: relative;
      video {
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        height: 100%;
        width: auto;
        background-image: url("https://yunlian-oss-product.oss-cn-hangzhou.aliyuncs.com/website/p.jpg");
        background-size: cover;
        background-position: center;
      }
    }
  }
  .item-divider {
    width: 75%;
    padding: 80px 100px;
    margin: 0 auto;
    .title-divider {
      width: 100%;
      min-width: 100%;
      border-top-color: rgba(0, 0, 0, 0.08);
      color: rgba(0, 0, 0, 0.85);
      white-space: nowrap;
      clear: both;
      display: flex;
      margin: 10px 0;
      .divider-text {
        display: inline-block;
        padding: 0 50px;
        .title-text {
          font-family: PingFangSC, PingFang SC;
          font-weight: 500;
          font-size: 82px;
          color: #333;
        }
      }
    }
    .title-divider:after,
    .title-divider:before {
      border-bottom: 0;
      border-top: 1px solid transparent;
      border-top-color: inherit;
      content: "";
      position: relative;
      top: 50%;
      transform: translateY(50%);
      width: 50%;
    }
  }
  .list-assort {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    .assort-item {
      width: 25%;
      height: 100%;
      margin-bottom: 50px;
      img {
        width: 100%;
        height: 312px;
      }
      p {
        width: 100%;
        text-align: center;
        font-family: PingFangSC, PingFang SC;
        font-weight: 400;
        font-size: 60px;
        color: #333;
        line-height: 80px;
        padding: 0 20px;
        box-sizing: border-box;
        margin-top: 20px;
      }
      &:last-child:nth-child(4n - 1) {
        margin-right: calc(25%);
      }
      &:last-child:nth-child(4n - 2) {
        margin-right: calc(50%);
      }
    }
  }
}
</style>
